<?php

namespace app\company\controller\user_profile\userArchive\selfTesting;

use app\company\service\user_profile\userArchive\selfTesting\SelfTestingService;
use app\BaseController;
use app\common\Message;
use think\App;

class SelfTesting extends BaseController
{
    use Message;

    /**
     * 获取自评档案概况
     * @return bool|string
     */
    public function getOverview(): bool|string
    {
       $param = $this->request->param();
       $param['uid'] = $this->userData['id'];
       try {
           $selfTesting = new SelfTestingService($this->app);
           if(!$selfTesting->getOverview($param)) throw new \Exception($selfTesting->getMessage());
           return success($selfTesting->getResult(),$selfTesting->getMessage());
       } catch (\Exception $e) {
           return error($e->getMessage(),$e->getCode(),[
                'line' => $e->getLine(),
                'file' => $e->getFile()
            ]);
       }
   }

    /**
     * 获取个人自评记录
     * @return bool|string
     */
    public function getRecode(): bool|string
    {
        $param = $this->request->param();
        $param['uid'] = $this->userData['id'];
        try {
            $selfTesting = new SelfTestingService($this->app);
            if(!$selfTesting->getRecode($param)) throw new \Exception($selfTesting->getMessage());
            return success($selfTesting->getResult(),$selfTesting->getMessage());
        } catch (\Exception $e) {
            return error($e->getMessage(),$e->getCode(),[
                'line' => $e->getLine(),
                'file' => $e->getFile()
            ]);
        }
    }

}